﻿namespace IPTableAdapters
{
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Configuration;
    using System.Data;
    using System.Data.Common;
    using System.Data.SqlClient;
    using System.Diagnostics;

    [DataObject(true), HelpKeyword("vs.data.TableAdapter"), DesignerCategory("code"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), ToolboxItem(true)]
    public class ProjectTableAdapter : Component
    {
        private SqlDataAdapter _adapter;
        private bool _clearBeforeFill;
        private SqlCommand[] _commandCollection;
        private SqlConnection _connection;

        /*[DebuggerNonUserCode]*/
        public ProjectTableAdapter()
        {
            this.ClearBeforeFill = true;
        }

        [DataObjectMethod(DataObjectMethodType.Select, false), DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual IP.ProjectDataTable _IPMS_GetProjectByTypeByGroupSp(string ProjectGroupId, string projecttype, bool? superuser, string Ownergroupid, string UserName)
        {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if (ProjectGroupId == null)
            {
                this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[1].Value = ProjectGroupId;
            }
            if (projecttype == null)
            {
                this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[2].Value = projecttype;
            }
            if (superuser.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[3].Value = superuser.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[3].Value = DBNull.Value;
            }
            if (Ownergroupid == null)
            {
                this.Adapter.SelectCommand.Parameters[4].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[4].Value = Ownergroupid;
            }
            if (UserName == null)
            {
                this.Adapter.SelectCommand.Parameters[5].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[5].Value = UserName;
            }

            IP.ProjectDataTable dataTable = new IP.ProjectDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode, DataObjectMethod(DataObjectMethodType.Delete, true)]
        public virtual int Delete(bool IsDelete, string DeleteBy, string DeleteIP, string Original_ProjectCode)
        {
            int ret;

            this.Adapter.DeleteCommand.Parameters[0].Value = IsDelete;

            if (DeleteBy == null)
            {
                throw new ArgumentNullException("DeleteBy");
            }
            this.Adapter.DeleteCommand.Parameters[1].Value = DeleteBy;

            if (DeleteIP == null)
            {
                this.Adapter.DeleteCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.DeleteCommand.Parameters[2].Value = DeleteIP;
            }
            if (Original_ProjectCode == null)
            {
                throw new ArgumentNullException("Original_ProjectCode");
            }
            this.Adapter.DeleteCommand.Parameters[3].Value = Original_ProjectCode;
            ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
            if ((this.Adapter.DeleteCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.DeleteCommand.Connection.Open();
            }
            try
            {
                ret = this.Adapter.DeleteCommand.ExecuteNonQuery();
            }
            finally
            {
                if (previousConnectionState == ConnectionState.Closed)
                {
                    this.Adapter.DeleteCommand.Connection.Close();
                }
            }
            return ret;
        }

        [DataObjectMethod(DataObjectMethodType.Select, true), DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual IP.ProjectDataTable dtProject(string SuperUser, string OwnerGroupID)
        {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            if (SuperUser == null)
            {
                throw new ArgumentNullException("SuperUser");
            }
            this.Adapter.SelectCommand.Parameters[0].Value = SuperUser;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.SelectCommand.Parameters[1].Value = OwnerGroupID;
            IP.ProjectDataTable dataTable = new IP.ProjectDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        [DebuggerNonUserCode, DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter")]
        public virtual IP.ProjectDataTable dtProjectByPGIandType(string ProjectGroupID, string ProjectType, string SuperUser, string OwnerGroupID, string UserName)
        {
            this.Adapter.SelectCommand = this.CommandCollection[2];
            if (ProjectGroupID == null)
            {
                this.Adapter.SelectCommand.Parameters[0].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[0].Value = ProjectGroupID;
            }
            if (ProjectType == null)
            {
                throw new ArgumentNullException("ProjectType");
            }
            this.Adapter.SelectCommand.Parameters[1].Value = ProjectType;
            if (SuperUser == null)
            {
                throw new ArgumentNullException("SuperUser");
            }
            this.Adapter.SelectCommand.Parameters[2].Value = SuperUser;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.SelectCommand.Parameters[3].Value = OwnerGroupID;
            if (UserName == null)
            {
                throw new ArgumentNullException("UserName");
            }
            this.Adapter.SelectCommand.Parameters[4].Value = UserName;
            IP.ProjectDataTable dataTable = new IP.ProjectDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Fill, false)]
        public virtual int dtProjectByPGIandType1(IP.ProjectDataTable dataTable, string ProjectGroupID, string ProjectType, string SuperUser, string OwnerGroupID, string UserName)
        {
            this.Adapter.SelectCommand = this.CommandCollection[2];
            if (ProjectGroupID == null)
            {
                this.Adapter.SelectCommand.Parameters[0].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[0].Value = ProjectGroupID;
            }
            if (ProjectType == null)
            {
                throw new ArgumentNullException("ProjectType");
            }
            this.Adapter.SelectCommand.Parameters[1].Value = ProjectType;
            if (SuperUser == null)
            {
                throw new ArgumentNullException("SuperUser");
            }
            this.Adapter.SelectCommand.Parameters[2].Value = SuperUser;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.SelectCommand.Parameters[3].Value = OwnerGroupID;
            if (UserName == null)
            {
                throw new ArgumentNullException("UserName");
            }
            this.Adapter.SelectCommand.Parameters[4].Value = UserName;
            if (this.ClearBeforeFill)
            {
                dataTable.Clear();
            }
            return this.Adapter.Fill(dataTable);
        }

        /*[DebuggerNonUserCode]*/
        private void InitAdapter()
        {
            this._adapter = new SqlDataAdapter();
            DataTableMapping tableMapping = new DataTableMapping();
            tableMapping.SourceTable = "Table";
            tableMapping.DataSetTable = "Project";
            tableMapping.ColumnMappings.Add("ProjectCode", "ProjectCode");
            tableMapping.ColumnMappings.Add("Type", "Type");
            tableMapping.ColumnMappings.Add("Status", "Status");
            tableMapping.ColumnMappings.Add("Country", "Country");
            tableMapping.ColumnMappings.Add("Agent", "Agent");
            tableMapping.ColumnMappings.Add("Title", "Title");
            tableMapping.ColumnMappings.Add("Applicant", "Applicant");
            tableMapping.ColumnMappings.Add("Inventor", "Inventor");
            tableMapping.ColumnMappings.Add("ApplicationNo", "ApplicationNo");
            tableMapping.ColumnMappings.Add("FilingDate", "FilingDate");
            tableMapping.ColumnMappings.Add("GrantDate", "GrantDate");
            tableMapping.ColumnMappings.Add("ProjectGroupID", "ProjectGroupID");
            tableMapping.ColumnMappings.Add("CreateBy", "CreateBy");
            tableMapping.ColumnMappings.Add("UpdateBy", "UpdateBy");
            tableMapping.ColumnMappings.Add("OwnerGroupID", "OwnerGroupID");
            tableMapping.ColumnMappings.Add("PatentNumber", "PatentNumber");
            tableMapping.ColumnMappings.Add("PriorityDate", "PriorityDate");
            tableMapping.ColumnMappings.Add("PriorityCountry", "PriorityCountry");
            tableMapping.ColumnMappings.Add("ClientName", "ClientName");
            tableMapping.ColumnMappings.Add("PublicationNumber", "PublicationNumber");
            tableMapping.ColumnMappings.Add("Remark", "Remark");
            tableMapping.ColumnMappings.Add("FirstFilingYN", "FirstFilingYN");
            tableMapping.ColumnMappings.Add("CountryEnglishName", "CountryEnglishName");
            tableMapping.ColumnMappings.Add("PriorityCountryEnglishName", "PriorityCountryEnglishName");
            tableMapping.ColumnMappings.Add("AltContactPerson", "AltContactPerson");
            tableMapping.ColumnMappings.Add("AltContactPersonTitle", "AltContactPersonTitle");
            tableMapping.ColumnMappings.Add("AltContactFax", "AltContactFax");
            tableMapping.ColumnMappings.Add("AltContactPhone", "AltContactPhone");
            tableMapping.ColumnMappings.Add("AltContactEmailAddress", "AltContactEmailAddress");
            tableMapping.ColumnMappings.Add("AgentCompanyName", "AgentCompanyName");
            tableMapping.ColumnMappings.Add("AgentChineseName", "AgentChineseName");
            tableMapping.ColumnMappings.Add("AgentAddress", "AgentAddress");
            tableMapping.ColumnMappings.Add("AgentContactPerson", "AgentContactPerson");
            tableMapping.ColumnMappings.Add("AgentJobTitle", "AgentJobTitle");
            tableMapping.ColumnMappings.Add("AgentPhone", "AgentPhone");
            tableMapping.ColumnMappings.Add("AgentFax", "AgentFax");
            tableMapping.ColumnMappings.Add("AgentPhone2", "AgentPhone2");
            tableMapping.ColumnMappings.Add("AgentMobilePhone", "AgentMobilePhone");
            tableMapping.ColumnMappings.Add("AgentMobilePhone2", "AgentMobilePhone2");
            tableMapping.ColumnMappings.Add("AgentWebSite", "AgentWebSite");
            tableMapping.ColumnMappings.Add("AgentEmailAddress", "AgentEmailAddress");
            tableMapping.ColumnMappings.Add("AgentEmailAddress2", "AgentEmailAddress2");
            tableMapping.ColumnMappings.Add("ClientCompanyName", "ClientCompanyName");
            tableMapping.ColumnMappings.Add("ClientChineseName", "ClientChineseName");
            tableMapping.ColumnMappings.Add("ClientAddress", "ClientAddress");
            tableMapping.ColumnMappings.Add("ClientContactPerson", "ClientContactPerson");
            tableMapping.ColumnMappings.Add("ClientJobTitle", "ClientJobTitle");
            tableMapping.ColumnMappings.Add("ClientPhone", "ClientPhone");
            tableMapping.ColumnMappings.Add("ClientFax", "ClientFax");
            tableMapping.ColumnMappings.Add("ClientPhone2", "ClientPhone2");
            tableMapping.ColumnMappings.Add("ClientMobilePhone", "ClientMobilePhone");
            tableMapping.ColumnMappings.Add("ClientMobilePhone2", "ClientMobilePhone2");
            tableMapping.ColumnMappings.Add("ClientWebSite", "ClientWebSite");
            tableMapping.ColumnMappings.Add("ClientEmailAddress", "ClientEmailAddress");
            tableMapping.ColumnMappings.Add("ClientEmailAddress2", "ClientEmailAddress2");
            tableMapping.ColumnMappings.Add("ProjectClass", "ProjectClass");
            tableMapping.ColumnMappings.Add("Priority", "Priority");
            tableMapping.ColumnMappings.Add("PCTYN", "PCTYN");
            tableMapping.ColumnMappings.Add("AgentContactPerson3", "AgentContactPerson3");
            tableMapping.ColumnMappings.Add("AgentContactPhone3", "AgentContactPhone3");
            tableMapping.ColumnMappings.Add("AgentContactEmailAddress3", "AgentContactEmailAddress3");
            tableMapping.ColumnMappings.Add("AgentContactFax3", "AgentContactFax3");
            tableMapping.ColumnMappings.Add("AgentContactPerson4", "AgentContactPerson4");
            tableMapping.ColumnMappings.Add("AgentContactPhone4", "AgentContactPhone4");
            tableMapping.ColumnMappings.Add("AgentContactEmailAddress4", "AgentContactEmailAddress4");
            tableMapping.ColumnMappings.Add("AgentContactFax4", "AgentContactFax4");
            tableMapping.ColumnMappings.Add("ClientContactFax4", "ClientContactFax4");
            tableMapping.ColumnMappings.Add("ClientContactEmailAddress4", "ClientContactEmailAddress4");
            tableMapping.ColumnMappings.Add("ClientContactPhone4", "ClientContactPhone4");
            tableMapping.ColumnMappings.Add("ClientContactPerson4", "ClientContactPerson4");
            tableMapping.ColumnMappings.Add("ClientContactFax3", "ClientContactFax3");
            tableMapping.ColumnMappings.Add("ClientContactEmailAddress3", "ClientContactEmailAddress3");
            tableMapping.ColumnMappings.Add("ClientContactPhone3", "ClientContactPhone3");
            tableMapping.ColumnMappings.Add("ClientContactPerson3", "ClientContactPerson3");
            tableMapping.ColumnMappings.Add("CreateIP", "CreateIP");
            tableMapping.ColumnMappings.Add("UpdateIP", "UpdateIP");
            tableMapping.ColumnMappings.Add("IsDelete", "IsDelete");
            tableMapping.ColumnMappings.Add("DeleteBy", "DeleteBy");
            tableMapping.ColumnMappings.Add("DeleteIP", "DeleteIP");
            this._adapter.TableMappings.Add(tableMapping);
            this._adapter.DeleteCommand = new SqlCommand();
            this._adapter.DeleteCommand.Connection = this.Connection;
            //this._adapter.DeleteCommand.CommandText = "DELETE FROM [Project] WHERE (([ProjectCode] = @Original_ProjectCode))";
            this._adapter.DeleteCommand.CommandText = "UPDATE [Project] SET IsDelete = @IsDelete,DeleteBy = @DeleteBy,DeleteDate = GETDATE(), DeleteIP = @DeleteIP WHERE (([ProjectCode] = @Original_ProjectCode))";
            this._adapter.DeleteCommand.CommandType = CommandType.Text;
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@IsDelete", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "IsDelete", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@DeleteBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "DeleteBy", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@DeleteIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, "DeleteIP", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_ProjectCode", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectCode", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.InsertCommand = new SqlCommand();
            this._adapter.InsertCommand.Connection = this.Connection;
            this._adapter.InsertCommand.CommandText = "INSERT INTO Project\r\n                      (ProjectCode, Type, Status, Country, Agent, Title, Applicant, Inventor, ApplicationNo, PatentNumber, PriorityDate, PriorityCountry, ClientName, \r\n                      FilingDate, GrantDate, FirstFilingYN, ProjectGroupID, PublicationNumber, Remark, AltContactPerson, AltContactPersonTitle, AltContactFax, \r\n                      AltContactPhone, AltContactEmailAddress, CreateBy, UpdateBy, OwnerGroupID, ProjectClass, Priority, PCTYN, AgentContactPerson3, \r\n                      AgentContactFax3, AgentContactPhone3, AgentContactEmailAddress3, AgentContactPerson4, AgentContactFax4, AgentContactPhone4, \r\n                      AgentContactEmailAddress4, ClientContactPerson3, ClientContactFax3, ClientContactPhone3, ClientContactEmailAddress3, ClientContactPerson4, \r\n                      ClientContactFax4, ClientContactPhone4, ClientContactEmailAddress4, CreateIP)\r\nVALUES     (@ProjectCode,@Type,@Status,@Country,@Agent,@Title,@Applicant,@Inventor,@ApplicationNo,@PatentNumber,@PriorityDate,@PriorityCountry,@ClientName,@FilingDate,@GrantDate,@FirstFilingYN,@ProjectGroupID,@PublicationNumber,@Remark,@AltContactPerson,@AltContactPersonTitle,@AltContactFax,@AltContactPhone,@AltContactEmailAddress,@CreateBy,@UpdateBy,@OwnerGroupID,@ProjectClass,@Priority,@PCTYN,@AgentContactPerson3,@AgentContactFax3,@AgentContactPhone3,@AgentContactEmailAddress3,@AgentContactPerson4,@AgentContactFax4,@AgentContactPhone4,@AgentContactEmailAddress4,@ClientContactPerson3,@ClientContactFax3,@ClientContactPhone3,@ClientContactEmailAddress3,@ClientContactPerson4,@ClientContactFax4,@ClientContactPhone4,@ClientContactEmailAddress4, @CreateIP)";
            this._adapter.InsertCommand.CommandType = CommandType.Text;
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ProjectCode", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectCode", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Type", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Type", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Status", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Country", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Country", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Agent", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Agent", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.NVarChar, 120, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Applicant", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Applicant", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Inventor", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Inventor", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ApplicationNo", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ApplicationNo", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@PatentNumber", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "PatentNumber", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@PriorityDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "PriorityDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@PriorityCountry", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "PriorityCountry", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientName", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientName", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@FilingDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "FilingDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@GrantDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "GrantDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@FirstFilingYN", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "FirstFilingYN", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@PublicationNumber", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "PublicationNumber", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Remark", SqlDbType.NVarChar, 200, ParameterDirection.Input, 0, 0, "Remark", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AltContactPerson", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactPerson", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AltContactPersonTitle", SqlDbType.NVarChar, 120, ParameterDirection.Input, 0, 0, "AltContactPersonTitle", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AltContactFax", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactFax", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AltContactPhone", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactPhone", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AltContactEmailAddress", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactEmailAddress", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@CreateBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "CreateBy", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@UpdateBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "UpdateBy", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OwnerGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OwnerGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ProjectClass", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectClass", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Priority", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "Priority", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@PCTYN", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "PCTYN", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactPerson3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPerson3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactFax3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactFax3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactPhone3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPhone3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactEmailAddress3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactEmailAddress3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactPerson4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPerson4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactFax4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactFax4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactPhone4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPhone4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AgentContactEmailAddress4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactEmailAddress4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactPerson3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPerson3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactFax3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactFax3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactPhone3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPhone3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactEmailAddress3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactEmailAddress3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactPerson4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPerson4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactFax4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactFax4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactPhone4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPhone4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClientContactEmailAddress4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactEmailAddress4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@CreateIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, "CreateIP", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand = new SqlCommand();
            this._adapter.UpdateCommand.Connection = this.Connection;
            this._adapter.UpdateCommand.CommandText = "UPDATE    Project\r\nSET              Type = @Type, Status = @Status, Country = @Country, Agent = @Agent, Title = @Title, Applicant = @Applicant, Inventor = @Inventor, \r\n                      ApplicationNo = @ApplicationNo, PatentNumber = @PatentNumber, PriorityDate = @PriorityDate, PriorityCountry = @PriorityCountry, \r\n                      ClientName = @ClientName, FilingDate = @FilingDate, GrantDate = @GrantDate, FirstFilingYN = @FirstFilingYN, ProjectGroupID = @ProjectGroupID, \r\n                      PublicationNumber = @PublicationNumber, Remark = @Remark, AltContactPerson = @AltContactPerson, \r\n                      AltContactPersonTitle = @AltContactPersonTitle, AltContactFax = @AltContactFax, AltContactPhone = @AltContactPhone, \r\n                      AltContactEmailAddress = @AltContactEmailAddress, UpdateBy = @UpdateBy, UpdateDate = GETDATE(), OwnerGroupID = @OwnerGroupID, \r\n                      ProjectClass = @ProjectClass, Priority = @Priority, PCTYN = @PCTYN, AgentContactPerson3 = @AgentContactPerson3, \r\n                      AgentContactFax3 = @AgentContactFax3, AgentContactPhone3 = @AgentContactPhone3, AgentContactEmailAddress3 = @AgentContactEmailAddress3, \r\n                      AgentContactPerson4 = @AgentContactPerson4, AgentContactFax4 = @AgentContactFax4, AgentContactPhone4 = @AgentContactPhone4, \r\n                      AgentContactEmailAddress4 = @AgentContactEmailAddress4, ClientContactPerson3 = @ClientContactPerson3, \r\n                      ClientContactFax3 = @ClientContactFax3, ClientContactPhone3 = @ClientContactPhone3, ClientContactEmailAddress3 = @ClientContactEmailAddress3, \r\n                      ClientContactPerson4 = @ClientContactPerson4, ClientContactFax4 = @ClientContactFax4, ClientContactPhone4 = @ClientContactPhone4, \r\n                      ClientContactEmailAddress4 = @ClientContactEmailAddress4, UpdateIP = @UpdateIP \r\nWHERE     (ProjectCode = @Original_ProjectCode)";
            this._adapter.UpdateCommand.CommandType = CommandType.Text;
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Type", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Type", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Status", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Country", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Country", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Agent", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Agent", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.NVarChar, 120, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Applicant", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Applicant", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Inventor", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Inventor", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ApplicationNo", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ApplicationNo", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@PatentNumber", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "PatentNumber", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@PriorityDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "PriorityDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@PriorityCountry", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "PriorityCountry", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientName", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientName", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@FilingDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "FilingDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@GrantDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "GrantDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@FirstFilingYN", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "FirstFilingYN", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@PublicationNumber", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "PublicationNumber", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Remark", SqlDbType.NVarChar, 200, ParameterDirection.Input, 0, 0, "Remark", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AltContactPerson", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactPerson", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AltContactPersonTitle", SqlDbType.NVarChar, 120, ParameterDirection.Input, 0, 0, "AltContactPersonTitle", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AltContactFax", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactFax", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AltContactPhone", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactPhone", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AltContactEmailAddress", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AltContactEmailAddress", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UpdateBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "UpdateBy", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OwnerGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OwnerGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ProjectClass", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectClass", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Priority", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "Priority", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@PCTYN", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "PCTYN", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactPerson3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPerson3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactFax3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactFax3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactPhone3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPhone3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactEmailAddress3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactEmailAddress3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactPerson4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPerson4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactFax4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactFax4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactPhone4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactPhone4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AgentContactEmailAddress4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "AgentContactEmailAddress4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactPerson3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPerson3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactFax3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactFax3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactPhone3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPhone3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactEmailAddress3", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactEmailAddress3", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactPerson4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPerson4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactFax4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactFax4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactPhone4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactPhone4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClientContactEmailAddress4", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ClientContactEmailAddress4", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UpdateIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, "UpdateIP", DataRowVersion.Current, false, null, "", "", ""));
            //this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UpdateDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "UpdateDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_ProjectCode", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectCode", DataRowVersion.Original, false, null, "", "", ""));
        }

        /*[DebuggerNonUserCode]*/
        private void InitCommandCollection()
        {
            this._commandCollection = new SqlCommand[3];
            this._commandCollection[0] = new SqlCommand();
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "SELECT     Project.Agent, Project.Applicant, Project.ApplicationNo, Project.ClientName, Project.Country, Project.CreateBy, Project.FilingDate, \r\n                      ISNULL(Project.FirstFilingYN, 0) AS FirstFilingYN, Project.GrantDate, Project.Inventor, Project.OwnerGroupID, Project.PatentNumber, \r\n                      Project.PriorityCountry, Project.PriorityDate, Project.ProjectCode, Project.ProjectGroupID, Project.PublicationNumber, Project.Remark, Project.Status, \r\n                      Project.Title, Project.Type, Project.UpdateBy, Project.PCTYN, cntry.EnglishName AS CountryEnglishName, \r\n                      priocntry.EnglishName AS PriorityCountryEnglishName, Project.AltContactPerson, Project.AltContactPersonTitle, Project.AltContactFax, \r\n                      Project.AltContactPhone, Project.AltContactEmailAddress, Project.ProjectClass, Project.Priority, Agent.Name AS AgentCompanyName, \r\n                      Agent.ChineseName AS AgentChineseName, Agent.Address AS AgentAddress, Agent.ContactPerson AS AgentContactPerson, \r\n                      Agent.JobTitle AS AgentJobTitle, Agent.Phone AS AgentPhone, Agent.Fax AS AgentFax, Agent.Phone2 AS AgentPhone2, \r\n                      Agent.MobilePhone AS AgentMobilePhone, Agent.MobilePhone2 AS AgentMobilePhone2, Agent.WebSite AS AgentWebSite, \r\n                      Agent.EmailAddress AS AgentEmailAddress, Agent.EmailAddress2 AS AgentEmailAddress2, Client.Name AS ClientCompanyName, \r\n                      Client.ChineseName AS ClientChineseName, Client.Address AS ClientAddress, Client.ContactPerson AS ClientContactPerson, \r\n                      Client.JobTitle AS ClientJobTitle, Client.Phone AS ClientPhone, Client.Fax AS ClientFax, Client.Phone2 AS ClientPhone2, \r\n                      Client.MobilePhone AS ClientMobilePhone, Client.MobilePhone2 AS ClientMobilePhone2, Client.WebSite AS ClientWebSite, \r\n                      Client.EmailAddress AS ClientEmailAddress, Client.EmailAddress2 AS ClientEmailAddress2\r\nFROM         Project LEFT OUTER JOIN\r\n                      Country AS priocntry ON Project.PriorityCountry = priocntry.Country LEFT OUTER JOIN\r\n                      Country AS cntry ON Project.Country = cntry.Country LEFT OUTER JOIN\r\n                      Client ON Project.ClientName = Client.Client LEFT OUTER JOIN\r\n                      Agent ON Project.Agent = Agent.Agent\r\nWHERE     (@SuperUser = 1) OR\r\n                      (Project.OwnerGroupID = @OwnerGroupID  AND Project.IsDelete = 0 )";
            this._commandCollection[0].CommandType = CommandType.Text;
            this._commandCollection[0].Parameters.Add(new SqlParameter("@SuperUser", SqlDbType.VarChar, 0x400, ParameterDirection.Input, 0, 0, "", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[0].Parameters.Add(new SqlParameter("@OwnerGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OwnerGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1] = new SqlCommand();
            this._commandCollection[1].Connection = this.Connection;
            this._commandCollection[1].CommandText = "dbo.[_IPMS_GetProjectByTypeByGroupSp]";
            this._commandCollection[1].CommandType = CommandType.StoredProcedure;
            this._commandCollection[1].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@ProjectGroupId", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@projecttype", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@superuser", SqlDbType.Bit, 1, ParameterDirection.Input, 1, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@Ownergroupid", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2] = new SqlCommand();
            this._commandCollection[2].Connection = this.Connection;
            this._commandCollection[2].CommandText = "SELECT     Project.Agent, Project.Applicant, Project.ApplicationNo, Project.ClientName, Project.Country, Project.CreateBy, Project.FilingDate, \r\n                      ISNULL(Project.FirstFilingYN, 0) AS FirstFilingYN, Project.GrantDate, Project.Inventor, Project.OwnerGroupID, Project.PatentNumber, \r\n                      Project.PriorityCountry, Project.PriorityDate, Project.ProjectCode, Project.ProjectGroupID, Project.PublicationNumber, Project.Remark, Project.Status, \r\n                      Project.Title, Project.Type, Project.UpdateBy, cntry.EnglishName AS CountryEnglishName, priocntry.EnglishName AS PriorityCountryEnglishName, \r\n                      Project.AltContactPerson, Project.AltContactPersonTitle, Project.AltContactFax, Project.AltContactPhone, Project.AltContactEmailAddress, \r\n                      Agent.Name AS AgentCompanyName, Agent.ChineseName AS AgentChineseName, Agent.Address AS AgentAddress, \r\n                      Agent.ContactPerson AS AgentContactPerson, Agent.JobTitle AS AgentJobTitle, Agent.Phone AS AgentPhone, Agent.Fax AS AgentFax, \r\n                      Agent.Phone2 AS AgentPhone2, Agent.MobilePhone AS AgentMobilePhone, Agent.MobilePhone2 AS AgentMobilePhone2, \r\n                      Agent.WebSite AS AgentWebSite, Agent.EmailAddress AS AgentEmailAddress, Agent.EmailAddress2 AS AgentEmailAddress2, \r\n                      Client.Name AS ClientCompanyName, Client.ChineseName AS ClientChineseName, Client.Address AS ClientAddress, \r\n                      Client.ContactPerson AS ClientContactPerson, Client.JobTitle AS ClientJobTitle, Client.Phone AS ClientPhone, Client.Fax AS ClientFax, \r\n                      Client.Phone2 AS ClientPhone2, Client.MobilePhone AS ClientMobilePhone, Client.MobilePhone2 AS ClientMobilePhone2, \r\n                      Client.WebSite AS ClientWebSite, Client.EmailAddress AS ClientEmailAddress, Client.EmailAddress2 AS ClientEmailAddress2, Project.ProjectClass, \r\n                      Project.Priority\r\nFROM         Project LEFT OUTER JOIN\r\n                      Country AS priocntry ON Project.PriorityCountry = priocntry.Country LEFT OUTER JOIN\r\n                      Country AS cntry ON Project.Country = cntry.Country LEFT OUTER JOIN\r\n                      Client ON Project.ClientName = Client.Client LEFT OUTER JOIN\r\n                      Agent ON Project.Agent = Agent.Agent\r\nWHERE     (Project.ProjectGroupID = @ProjectGroupID) AND (Project.Type = @ProjectType) AND (@SuperUser = 1) OR\r\n                      (Project.ProjectGroupID = @ProjectGroupID) AND (@SuperUser = 1) AND (@ProjectType IS NULL) OR\r\n                      (Project.ProjectGroupID = @ProjectGroupID) AND (Project.Type = @ProjectType) AND (Project.OwnerGroupID = @OwnerGroupID) AND \r\n                      (dbo._IPMS_IsProjResp(Project.ProjectCode, @UserName) = 1) OR\r\n                      (Project.ProjectGroupID = @ProjectGroupID) AND (@ProjectType IS NULL) AND (Project.OwnerGroupID = @OwnerGroupID) AND \r\n                      (dbo._IPMS_IsProjResp(Project.ProjectCode, @UserName) = 1)";
            this._commandCollection[2].CommandType = CommandType.Text;
            this._commandCollection[2].Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@ProjectType", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Type", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@SuperUser", SqlDbType.VarChar, 0x400, ParameterDirection.Input, 0, 0, "", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@OwnerGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OwnerGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
        }

        /*[DebuggerNonUserCode]*/
        private void InitConnection()
        {
            this._connection = new SqlConnection();
            this._connection.ConnectionString = ConfigurationManager.ConnectionStrings["LocalSqlConnection1"].ConnectionString;
        }

        [DataObjectMethod(DataObjectMethodType.Insert, true), DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Insert(string ProjectCode, string Type, string Status, string Country, string Agent, string Title, string Applicant, string Inventor, string ApplicationNo, string PatentNumber, DateTime? PriorityDate, string PriorityCountry, string ClientName, DateTime? FilingDate, DateTime? GrantDate, bool? FirstFilingYN, string ProjectGroupID, string PublicationNumber, string Remark, string AltContactPerson, string AltContactPersonTitle, string AltContactFax, string AltContactPhone, string AltContactEmailAddress, string CreateBy, string UpdateBy, string OwnerGroupID, string ProjectClass, bool? Priority, bool? PCTYN, string AgentContactPerson3, string AgentContactFax3, string AgentContactPhone3, string AgentContactEmailAddress3, string AgentContactPerson4, string AgentContactFax4, string AgentContactPhone4, string AgentContactEmailAddress4, string ClientContactPerson3, string ClientContactFax3, string ClientContactPhone3, string ClientContactEmailAddress3, string ClientContactPerson4, string ClientContactFax4, string ClientContactPhone4, string ClientContactEmailAddress4, string CreateIP)
        {
            int ret;
            if (ProjectCode == null)
            {
                throw new ArgumentNullException("ProjectCode");
            }
            this.Adapter.InsertCommand.Parameters[0].Value = ProjectCode;
            if (Type == null)
            {
                throw new ArgumentNullException("Type");
            }
            this.Adapter.InsertCommand.Parameters[1].Value = Type;
            if (Status == null)
            {
                this.Adapter.InsertCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[2].Value = Status;
            }
            if (Country == null)
            {
                this.Adapter.InsertCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[3].Value = Country;
            }
            if (Agent == null)
            {
                this.Adapter.InsertCommand.Parameters[4].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[4].Value = Agent;
            }
            if (Title == null)
            {
                this.Adapter.InsertCommand.Parameters[5].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[5].Value = Title;
            }
            if (Applicant == null)
            {
                this.Adapter.InsertCommand.Parameters[6].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[6].Value = Applicant;
            }
            if (Inventor == null)
            {
                this.Adapter.InsertCommand.Parameters[7].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[7].Value = Inventor;
            }
            if (ApplicationNo == null)
            {
                this.Adapter.InsertCommand.Parameters[8].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[8].Value = ApplicationNo;
            }
            if (PatentNumber == null)
            {
                this.Adapter.InsertCommand.Parameters[9].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[9].Value = PatentNumber;
            }
            if (PriorityDate.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[10].Value = PriorityDate.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[10].Value = DBNull.Value;
            }
            if (PriorityCountry == null)
            {
                this.Adapter.InsertCommand.Parameters[11].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[11].Value = PriorityCountry;
            }
            if (ClientName == null)
            {
                this.Adapter.InsertCommand.Parameters[12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[12].Value = ClientName;
            }
            if (FilingDate.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[13].Value = FilingDate.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[13].Value = DBNull.Value;
            }
            if (GrantDate.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[14].Value = GrantDate.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[14].Value = DBNull.Value;
            }
            if (FirstFilingYN.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[15].Value = FirstFilingYN.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[15].Value = DBNull.Value;
            }
            if (ProjectGroupID == null)
            {
                this.Adapter.InsertCommand.Parameters[0x10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x10].Value = ProjectGroupID;
            }
            if (PublicationNumber == null)
            {
                this.Adapter.InsertCommand.Parameters[0x11].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x11].Value = PublicationNumber;
            }
            if (Remark == null)
            {
                this.Adapter.InsertCommand.Parameters[0x12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x12].Value = Remark;
            }
            if (AltContactPerson == null)
            {
                this.Adapter.InsertCommand.Parameters[0x13].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x13].Value = AltContactPerson;
            }
            if (AltContactPersonTitle == null)
            {
                this.Adapter.InsertCommand.Parameters[20].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[20].Value = AltContactPersonTitle;
            }
            if (AltContactFax == null)
            {
                this.Adapter.InsertCommand.Parameters[0x15].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x15].Value = AltContactFax;
            }
            if (AltContactPhone == null)
            {
                this.Adapter.InsertCommand.Parameters[0x16].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x16].Value = AltContactPhone;
            }
            if (AltContactEmailAddress == null)
            {
                this.Adapter.InsertCommand.Parameters[0x17].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x17].Value = AltContactEmailAddress;
            }
            if (CreateBy == null)
            {
                throw new ArgumentNullException("CreateBy");
            }
            this.Adapter.InsertCommand.Parameters[0x18].Value = CreateBy;
            if (UpdateBy == null)
            {
                throw new ArgumentNullException("UpdateBy");
            }
            this.Adapter.InsertCommand.Parameters[0x19].Value = UpdateBy;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.InsertCommand.Parameters[0x1a].Value = OwnerGroupID;
            if (ProjectClass == null)
            {
                this.Adapter.InsertCommand.Parameters[0x1b].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x1b].Value = ProjectClass;
            }
            if (Priority.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[0x1c].Value = Priority.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x1c].Value = DBNull.Value;
            }
            if (PCTYN.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[0x1d].Value = PCTYN.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x1d].Value = DBNull.Value;
            }
            if (AgentContactPerson3 == null)
            {
                this.Adapter.InsertCommand.Parameters[30].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[30].Value = AgentContactPerson3;
            }
            if (AgentContactFax3 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x1f].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x1f].Value = AgentContactFax3;
            }
            if (AgentContactPhone3 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x20].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x20].Value = AgentContactPhone3;
            }
            if (AgentContactEmailAddress3 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x21].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x21].Value = AgentContactEmailAddress3;
            }
            if (AgentContactPerson4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x22].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x22].Value = AgentContactPerson4;
            }
            if (AgentContactFax4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x23].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x23].Value = AgentContactFax4;
            }
            if (AgentContactPhone4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x24].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x24].Value = AgentContactPhone4;
            }
            if (AgentContactEmailAddress4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x25].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x25].Value = AgentContactEmailAddress4;
            }
            if (ClientContactPerson3 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x26].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x26].Value = ClientContactPerson3;
            }
            if (ClientContactFax3 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x27].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x27].Value = ClientContactFax3;
            }
            if (ClientContactPhone3 == null)
            {
                this.Adapter.InsertCommand.Parameters[40].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[40].Value = ClientContactPhone3;
            }
            if (ClientContactEmailAddress3 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x29].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x29].Value = ClientContactEmailAddress3;
            }
            if (ClientContactPerson4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x2a].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x2a].Value = ClientContactPerson4;
            }
            if (ClientContactFax4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x2b].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x2b].Value = ClientContactFax4;
            }
            if (ClientContactPhone4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x2c].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x2c].Value = ClientContactPhone4;
            }
            if (ClientContactEmailAddress4 == null)
            {
                this.Adapter.InsertCommand.Parameters[0x2d].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x2d].Value = ClientContactEmailAddress4;
            }
            if (CreateIP == null)
            {
                this.Adapter.InsertCommand.Parameters[46].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[46].Value = CreateIP;
            }
            ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
            if ((this.Adapter.InsertCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.InsertCommand.Connection.Open();
            }
            try
            {
                ret = this.Adapter.InsertCommand.ExecuteNonQuery();
            }
            finally
            {
                if (previousConnectionState == ConnectionState.Closed)
                {
                    this.Adapter.InsertCommand.Connection.Close();
                }
            }
            return ret;
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(IP dataSet)
        {
            return this.Adapter.Update(dataSet, "Project");
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode]
        public virtual int Update(DataRow[] dataRows)
        {
            return this.Adapter.Update(dataRows);
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(IP.ProjectDataTable dataTable)
        {
            return this.Adapter.Update(dataTable);
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode]
        public virtual int Update(DataRow dataRow)
        {
            return this.Adapter.Update(new DataRow[] { dataRow });
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode, DataObjectMethod(DataObjectMethodType.Update, true)]
        public virtual int Update(string Type, string Status, string Country, string Agent, string Title, string Applicant, string Inventor, string ApplicationNo, string PatentNumber, DateTime? PriorityDate, string PriorityCountry, string ClientName, DateTime? FilingDate, DateTime? GrantDate, bool? FirstFilingYN, string ProjectGroupID, string PublicationNumber, string Remark, string AltContactPerson, string AltContactPersonTitle, string AltContactFax, string AltContactPhone, string AltContactEmailAddress, string UpdateBy, string OwnerGroupID, string ProjectClass, bool? Priority, bool? PCTYN, string AgentContactPerson3, string AgentContactFax3, string AgentContactPhone3, string AgentContactEmailAddress3, string AgentContactPerson4, string AgentContactFax4, string AgentContactPhone4, string AgentContactEmailAddress4, string ClientContactPerson3, string ClientContactFax3, string ClientContactPhone3, string ClientContactEmailAddress3, string ClientContactPerson4, string ClientContactFax4, string ClientContactPhone4, string ClientContactEmailAddress4, string UpdateIP, string Original_ProjectCode)
        {
            int ret;
            if (Type == null)
            {
                throw new ArgumentNullException("Type");
            }
            this.Adapter.UpdateCommand.Parameters[0].Value = Type;
            if (Status == null)
            {
                this.Adapter.UpdateCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[1].Value = Status;
            }
            if (Country == null)
            {
                this.Adapter.UpdateCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[2].Value = Country;
            }
            if (Agent == null)
            {
                this.Adapter.UpdateCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[3].Value = Agent;
            }
            if (Title == null)
            {
                this.Adapter.UpdateCommand.Parameters[4].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[4].Value = Title;
            }
            if (Applicant == null)
            {
                this.Adapter.UpdateCommand.Parameters[5].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[5].Value = Applicant;
            }
            if (Inventor == null)
            {
                this.Adapter.UpdateCommand.Parameters[6].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[6].Value = Inventor;
            }
            if (ApplicationNo == null)
            {
                this.Adapter.UpdateCommand.Parameters[7].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[7].Value = ApplicationNo;
            }
            if (PatentNumber == null)
            {
                this.Adapter.UpdateCommand.Parameters[8].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[8].Value = PatentNumber;
            }
            if (PriorityDate.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[9].Value = PriorityDate.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[9].Value = DBNull.Value;
            }
            if (PriorityCountry == null)
            {
                this.Adapter.UpdateCommand.Parameters[10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[10].Value = PriorityCountry;
            }
            if (ClientName == null)
            {
                this.Adapter.UpdateCommand.Parameters[11].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[11].Value = ClientName;
            }
            if (FilingDate.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[12].Value = FilingDate.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[12].Value = DBNull.Value;
            }
            if (GrantDate.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[13].Value = GrantDate.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[13].Value = DBNull.Value;
            }
            if (FirstFilingYN.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[14].Value = FirstFilingYN.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[14].Value = DBNull.Value;
            }
            if (ProjectGroupID == null)
            {
                this.Adapter.UpdateCommand.Parameters[15].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[15].Value = ProjectGroupID;
            }
            if (PublicationNumber == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x10].Value = PublicationNumber;
            }
            if (Remark == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x11].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x11].Value = Remark;
            }
            if (AltContactPerson == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x12].Value = AltContactPerson;
            }
            if (AltContactPersonTitle == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x13].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x13].Value = AltContactPersonTitle;
            }
            if (AltContactFax == null)
            {
                this.Adapter.UpdateCommand.Parameters[20].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[20].Value = AltContactFax;
            }
            if (AltContactPhone == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x15].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x15].Value = AltContactPhone;
            }
            if (AltContactEmailAddress == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x16].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x16].Value = AltContactEmailAddress;
            }
            if (UpdateBy == null)
            {
                throw new ArgumentNullException("UpdateBy");
            }
            this.Adapter.UpdateCommand.Parameters[0x17].Value = UpdateBy;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.UpdateCommand.Parameters[0x18].Value = OwnerGroupID;
            if (ProjectClass == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x19].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x19].Value = ProjectClass;
            }
            if (Priority.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[0x1a].Value = Priority.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x1a].Value = DBNull.Value;
            }
            if (PCTYN.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[0x1b].Value = PCTYN.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x1b].Value = DBNull.Value;
            }
            if (AgentContactPerson3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x1c].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x1c].Value = AgentContactPerson3;
            }
            if (AgentContactFax3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x1d].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x1d].Value = AgentContactFax3;
            }
            if (AgentContactPhone3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[30].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[30].Value = AgentContactPhone3;
            }
            if (AgentContactEmailAddress3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x1f].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x1f].Value = AgentContactEmailAddress3;
            }
            if (AgentContactPerson4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x20].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x20].Value = AgentContactPerson4;
            }
            if (AgentContactFax4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x21].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x21].Value = AgentContactFax4;
            }
            if (AgentContactPhone4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x22].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x22].Value = AgentContactPhone4;
            }
            if (AgentContactEmailAddress4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x23].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x23].Value = AgentContactEmailAddress4;
            }
            if (ClientContactPerson3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x24].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x24].Value = ClientContactPerson3;
            }
            if (ClientContactFax3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x25].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x25].Value = ClientContactFax3;
            }
            if (ClientContactPhone3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x26].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x26].Value = ClientContactPhone3;
            }
            if (ClientContactEmailAddress3 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x27].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x27].Value = ClientContactEmailAddress3;
            }
            if (ClientContactPerson4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[40].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[40].Value = ClientContactPerson4;
            }
            if (ClientContactFax4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x29].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x29].Value = ClientContactFax4;
            }
            if (ClientContactPhone4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x2a].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x2a].Value = ClientContactPhone4;
            }
            if (ClientContactEmailAddress4 == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x2b].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x2b].Value = ClientContactEmailAddress4;
            }
            if (UpdateIP == null)
            {
                this.Adapter.UpdateCommand.Parameters[0x2c].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[0x2c].Value = UpdateIP;
            }
            if (Original_ProjectCode == null)
            {
                throw new ArgumentNullException("Original_ProjectCode");
            }
            this.Adapter.UpdateCommand.Parameters[0x2d].Value = Original_ProjectCode;
            ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
            if ((this.Adapter.UpdateCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.UpdateCommand.Connection.Open();
            }
            try
            {
                ret = this.Adapter.UpdateCommand.ExecuteNonQuery();
            }
            finally
            {
                if (previousConnectionState == ConnectionState.Closed)
                {
                    this.Adapter.UpdateCommand.Connection.Close();
                }
            }
            return ret;
        }

        /*[DebuggerNonUserCode]*/
        private SqlDataAdapter Adapter
        {
            get
            {
                if (this._adapter == null)
                {
                    this.InitAdapter();
                }
                return this._adapter;
            }
        }

        /*[DebuggerNonUserCode]*/
        public bool ClearBeforeFill
        {
            get
            {
                return this._clearBeforeFill;
            }
            set
            {
                this._clearBeforeFill = value;
            }
        }

        /*[DebuggerNonUserCode]*/
        protected SqlCommand[] CommandCollection
        {
            get
            {
                if (this._commandCollection == null)
                {
                    this.InitCommandCollection();
                }
                return this._commandCollection;
            }
        }

        /*[DebuggerNonUserCode]*/
        internal SqlConnection Connection
        {
            get
            {
                if (this._connection == null)
                {
                    this.InitConnection();
                }
                return this._connection;
            }
            set
            {
                this._connection = value;
                if (this.Adapter.InsertCommand != null)
                {
                    this.Adapter.InsertCommand.Connection = value;
                }
                if (this.Adapter.DeleteCommand != null)
                {
                    this.Adapter.DeleteCommand.Connection = value;
                }
                if (this.Adapter.UpdateCommand != null)
                {
                    this.Adapter.UpdateCommand.Connection = value;
                }
                for (int i = 0; i < this.CommandCollection.Length; i++)
                {
                    if (this.CommandCollection[i] != null)
                    {
                        this.CommandCollection[i].Connection = value;
                    }
                }
            }
        }
    }
}

